-module(fun_http_server).
-include("common.hrl").
-export([do_init/0,do_info/1,do_msg/1,do_close/0,do_time/1,do_call/1]).
do_init()->
	ssl:start(),
	start_listen().
start_listen() ->
	inets:start(),
	{ok, Pid} = inets:start(httpd, ?HTTPD_LISTEN_SET), 
	put(httpserver,Pid).


do_info(Msg)->
	?log_error("do_info,info=~p", [Msg]),
	ok.
do_close()	->
	case get(httpserver) of  
		Pid when erlang:is_pid(Pid)->
			inets:stop(httpd, Pid);
		_->skip
	end.

do_msg(Msg) -> ?log_error("Msg = ~p",[Msg]).

do_call(_Msg)->no_match.

do_time(_Time)-> 1000.